package com.czxy.Service;

import com.czxy.dao.AdminMapper;
import com.czxy.domain.Admin;
import com.czxy.utils.MyBatisUtils;

public class AdminService {
    public Admin login(Admin admin){
        AdminMapper mapper = MyBatisUtils.getMapper(AdminMapper.class);
        Admin adminByUserName = mapper.findAdminByUserName(admin.getUsername());
        MyBatisUtils.close();
        if (adminByUserName!=null){
            if (admin.getPassword().endsWith(adminByUserName.getPassword())){
                //正确
                return adminByUserName;
            }
        }
        return null;
    }
}
